import itertools


def permute(nums):
    if len(nums) == 0:
        return nums

    def __sup(r, nums):
        if len(nums) == 0:
            res.append(r)
        for i in nums:
            r_ = r.copy()
            r_.append(i)
            nums_ = nums.copy()
            nums_.remove(i)
            __sup(r_, nums_)

    res, r = [], []
    __sup(r, nums)
    return res


def permute_(nums):
    return list(itertools.permutations(nums))

